package com.galen.wxRead;

import com.galen.wxRead.redis.RedisCache;
import com.galen.wxRead.server.OpenApiServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;


@Component
public class StartUpRunner implements ApplicationRunner {

    @Autowired
    private OpenApiServer openApiServer;

    @Autowired
    private RedisCache redisCache;

    @Override
    public void run(ApplicationArguments args) throws Exception {


        //阅读版本
        new Thread(new Runnable() {
            @Override
            public void run() {
                openApiServer.readWxTask();
            }
        }).start();
        /*
        //主控制
        new Thread(new Runnable() {
            @Override
            public void run() {
                openApiServer.dealReadWx();
            }
        }).start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                openApiServer.delInfo();
            }
        }).start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    openApiServer.dealUnFinish();
                    try {
                        Thread.sleep(1000 * 60 * 5);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();*/
    }
}
